package hk.linkcredit.walletservice.rocketmq;

import hk.linkcredit.common.rocketmq.producer.MqProducer;
import hk.linkcredit.walletservice.wallet.domain.vo.WalletAccountMsg;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Jamnsin
 * @date 2022-08-05 15:00:00
 */
@Slf4j
@Component
public class WalletProducer {

    @Resource
    private MqProducer mqProducer;

    @Value("${rocketmq.topics.walletAmountChangedTopic}")
    private String walletAmountChangedTopic;

    public SendResult sendWalletAccountAmountMessage(String tag, WalletAccountMsg walletAccountMsg) {
        return mqProducer.syncSendWithTag(walletAmountChangedTopic, tag, walletAccountMsg);
    }

}
